package com.example.composetutorial

import android.annotation.SuppressLint
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Box


import androidx.compose.foundation.layout.PaddingValues

import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Home
import androidx.compose.material.icons.filled.List
import androidx.compose.material.icons.filled.Menu
import androidx.compose.material.icons.filled.Settings
import androidx.compose.material3.AlertDialogDefaults.containerColor
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.FabPosition
import androidx.compose.material3.FloatingActionButton
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.NavigationBar
import androidx.compose.material3.NavigationBarItem
import androidx.compose.material3.NavigationBarItemDefaults
import androidx.compose.material3.Scaffold
import androidx.compose.material3.ScaffoldDefaults
import androidx.compose.material3.SnackbarHost
import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.contentColorFor
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.paint
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp

data class Item(
    val name: String,
    val icon: ImageVector
)

@Composable
fun content_1(paddingValues: PaddingValues) {
    Box {
        Text("text")
    }

}


/*@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter")
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun Scaffold_1() {

    var selectedItem by remember { mutableStateOf(0) }

    val items = listOf(
        Item("homepage ", Icons.Filled.Home),
        Item("list", Icons.Filled.List),
        Item("setting", Icons.Filled.Settings)
    )*/

    /* Scaffold(modifier=Modifier,topBar = {
        TopAppBar(
            title = {
                Text("homepage")
            },
            modifier = Modifier
                .background(Color.Red)
                .border(3.dp, Color.Blue, RectangleShape)
                .padding(10.dp),
            navigationIcon = {
                IconButton(
                    onClick = {*//* TODO *//* }
                ) {
                    Icon(Icons.Filled.Menu, null)
                }
            }
        )
    }, bottomBar = {
        NavigationBar {

    }
    }, snackbarHost = { SnackbarHost(hostState =SnackbarHostState() ) },
        floatingActionButton = {
            FloatingActionButton(
            onClick = { *//*TODO*//* }) {

        }
        },
        floatingActionButtonPosition = FabPosition.End,
        containerColor = MaterialTheme.colorScheme.background,
        contentColor =contentColorFor(containerColor),
        contentWindowInsets = ScaffoldDefaults.contentWindowInsets,
        content = {content_1(paddingValues = PaddingValues(3.dp,3.dp))}
    ) {
        Text("主页界面")
    }*/


    /*Scaffold(
        Modifier,
        {
            TopAppBar(
                title = {
                    Text("homepage")
                },
                modifier = Modifier
                    .background(Color.Red)
                    .border(3.dp, Color.Blue, RectangleShape)
                    .padding(10.dp),
                navigationIcon = {
                    IconButton(
                        onClick = {   }
                    ) {
                        Icon(Icons.Filled.Menu, null)
                    }
                }
            )
        },
        {
            NavigationBar {items.forEachIndexed { index, item ->
                NavigationBarItem(
                    selected = selectedItem == index,
                    onClick = { selectedItem = index
                              println(item.name)
                        Nav
                    },
                    icon = { Icon(item.icon,"des")},
                    alwaysShowLabel = true,
                    enabled =if(index==2)false else true  ,
                    label = { Text(item.name) },
                            colors = NavigationBarItemDefaults.colors(selectedIconColor = Color.Green, selectedTextColor = Color.Blue, unselectedIconColor = Color.Red, unselectedTextColor =Color.Yellow, disabledIconColor = Color.DarkGray , disabledTextColor = Color.Cyan , indicatorColor = Color.Black  ),
                    interactionSource = MutableInteractionSource()
                )
            }

            }
        },
        { SnackbarHost(hostState =SnackbarHostState() ) },
        {
            FloatingActionButton(
                onClick = {  }, shape = CircleShape,  content = {
                    Text(text = "FFF")

       Icon( items[0].icon, contentDescription ="BingWallpaper", modifier = Modifier, tint = Color.Red )}).se},
        FabPosition.End,
        MaterialTheme.colorScheme.secondary,
        contentColorFor(containerColor),
        ScaffoldDefaults.contentWindowInsets,
        {content_1(paddingValues = PaddingValues(0.dp,0.dp))}
    )
}
*/


/*
drawerContent = {
    Text ("Hello")
}*/
